< previous page page_685 next page >

Page 685
Set the AutoRedraw Property to True
If AutoRedraw is set to True, Visual Basic will keep a bitmap of the form in memory. It uses this bitmap to redraw the form after its revealed from another window covering it. This consumes a lot of memory at runtime, so you need to be careful with this one. If youre not using any graphic methods, you should set AutoRedraw to False. Most business applications can set AutoRedraw to False. This property applies to forms and picture controls.
Size Optimization Tricks
In addition to speeding up your application, you may also want to cut the size of your EXE file. This makes the application easier to distribute and faster to load. It also keeps the memory at runtime to a minimum, which can help your application run faster. Of course, by optimizing for size, you may sometimes find you have some maintenance issues. Lets first take a look at some sizing issues and then you can decide for yourself.
Use a Controls Default Property
In versions of Visual Basic prior to Visual Basic 5, if you eliminated a controls default property (such as Text or Caption), you would see about a 10 to 15 percent speed increase. For example,
lblZip.Caption = "Zip Code"
would be slower than
lblZip = ''Zip Code''
However, with the new compiler in Visual Basic 5 and 6, this is no longer true. Both ways are equivalent now.

On the Compile tab of the Project, Properties menu, you are able to compile to Native code. You are also allowed to set an option to optimize for speed or size.

 
< previous page page_685 next page >

If you like this book, buy it!